//
//  WebSocketJieshuResult.swift
//  JiaoZiTaxi
//
//  Created by Hu Gang on 2022/12/7.
//

import Foundation

// MARK: - PurpleData
struct WebSocketJieshuResult: Codable {
    let cmd: String
    let detectionID: Int
//    let driver: Driver
    let endLat, endLon, endTimestamp : Int
    let mydistance: Double
    let peopleID: String
    let price: Int
    let receiverID: String?
    let renshu, sended, shijirenshu, startLat: Int
    let startLon, startTimestamp: Int
    let status, subCmd: String
    let order_type: Int

    enum CodingKeys: String, CodingKey {
        case cmd
        case detectionID = "detectionId"
//        case driver
        case endLat = "end_lat"
        case endLon = "end_lon"
        case endTimestamp = "end_timestamp"
        case mydistance
        case peopleID = "peopleId"
        case price
        case receiverID = "receiverId"
        case renshu, sended, shijirenshu
        case startLat = "start_lat"
        case startLon = "start_lon"
        case startTimestamp = "start_timestamp"
        case status, subCmd
        case order_type
    }
}

// MARK: - Driver
struct Driver: Codable {
    let age, agree: Int
    let carLat, carLon: Double
    let carType, chepai, cmd: String
    let distance, driver, fanwei: Int
    let jianceHangye: String
    let jianceXingzhi: Int
    let jianceZizhi, laosPhone: String
    let lat, lon: Double
    let name: String
    let online: Int
    let openid, peopleID, phone: String
    let sex, status, validate, zans: Int

    enum CodingKeys: String, CodingKey {
        case age, agree
        case carLat = "car_lat"
        case carLon = "car_lon"
        case carType = "car_type"
        case chepai, cmd, distance, driver, fanwei
        case jianceHangye = "jiance_hangye"
        case jianceXingzhi = "jiance_xingzhi"
        case jianceZizhi = "jiance_zizhi"
        case laosPhone = "laos_phone"
        case lat, lon, name, online, openid
        case peopleID = "peopleId"
        case phone, sex, status, validate, zans
    }
}
